﻿// See https://aka.ms/new-console-template for more information
using System.Runtime.CompilerServices;

class Program{
    
    static void Main()
    {   
    //   Yhs yhs =new Yhs();
    //   yhs.sr();
    //   Jsq.Jsq1();
                Jsq obj=new Jsq();
            //  int sum1 = obj.multiply(2,4);
            //  Console.WriteLine($"{sum1}");
            //  double sum2  = obj.multiply(2.3,3.4);
            //  Console.WriteLine($"{sum2}");
            //  string world= obj.pin();
            //  Console.WriteLine($"{world}");
                int sum3= obj.Counter();
                Console.WriteLine($"{sum3}");
             
    }
}
   public class Yhs{
     public void sr(){
         Console.WriteLine("请输入考试成绩：");
       int score=Convert.ToInt32(Console.ReadLine());
       if(score<0||score>100){
        Console.WriteLine("输入无效，请重新输入");
        return;
       }
        char grade;
        if(score>=90) grade='A';
        else if(score>=80) grade='B';
        else if(score>=70) grade='C';
        else if(score>=60) grade='D';
        else grade='E';
        Console.WriteLine($"{grade}");
    }
   }
    public class Jsq{
        
     public static void Jsq1(){
        Console.WriteLine("数字+平方");
        for (int i = 1; i <=10; i++)
        {
            Console.WriteLine($"{i}\t{i*i}");
        }
    }
    public int multiply(int a,int b){ 
        int c =a*b;
        return c;
    }
    public double multiply(double a,double b){
      
        return a+b;
    }
    public  string pin(){
        string sentence="Hello World!";
        string firstName="张";
        string lastName="三";
        string allName=firstName+lastName;
        // Console.WriteLine($"{allName}");
        string Sentence= sentence.ToUpper();
        string Sentence2=sentence.Replace("World","#C");
        return Sentence2;
    }
// 编写一个程序，提示用户输入两个数字和一个运算符（+、-、*、/）。
// 根据用户输入的运算符，计算结果并输出。
     public   int Counter(){
        Console.WriteLine("请输入第一个数字：");
        int score1=Convert.ToInt32(Console.ReadLine());
        Console.WriteLine("请输入第二个数字：");
        int score2=Convert.ToInt32(Console.ReadLine());
        Console.WriteLine("请输入运算符：");
        char score3=Convert.ToChar(Console.ReadLine());

        switch (score3)
        {   
            case '+' : return score1+score2;
            case '-' : return score1-score2;
            case '*' : return score1*score2;
            case '/' : return score1%score2;
            default: throw new ArgumentException("无效字符");
        }
       
        
    }

};
   

